package com.tanhua.dubbo.server.service;

import com.tanhua.dubbo.server.enums.IdType;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class IdService {

    @Autowired
    private RedisTemplate<String,String> redisTemplate;

    public Long createId(IdType idType){
        String idKey="TANHUA_TD_"+ idType.toString();
        Long increment = redisTemplate.opsForValue().increment(idKey);
        log.debug("执行IdService返回的数据是："+increment);
        return increment;
    }
}
